#include "htf_engine.h"
#include "los_task.h"
#include <stdio.h>

extern VOID HtfAISchedulerStart(VOID);

void HtfInitTask(void) {
    printf("HTF Engine initializing...\n");
    htf_ai_init();
    HtfAISchedulerStart(); // Start periodic AI task
    // Do not exit; LiteOS_M tasks must keep running or be suspended
    while (1) {
        LOS_TaskDelay(100); // Avoid task termination
    }
}

void HtfInit(void) {
    UINT32 taskID;
    TSK_INIT_PARAM_S task = {0};
    task.pfnTaskEntry = (TSK_ENTRY_FUNC)HtfInitTask;
    task.uwStackSize = 0x1000;
    task.pcName = "HtfTask";
    task.usTaskPrio = 20;
    LOS_TaskCreate(&taskID, &task);
}